﻿
$("#addPup").click(function () {
    alert(number)
    layer.open({
        type: 1,
        title: '新增功能',
        area: ['700px', ''],
        shadeClose: false,
        content: $('#add_administrator_style'),
    });
    $("#btn2").click(function () {
        var data = {};
        data.UserId = "@user.UserId";
        data.FileName = $("#FileName").val();
        data.Remark = $("#Remark").val();
        $("#btn2").click(function () {
            $.ajax({
                url: "/MyFile/AddFile",
                type: "post",
                data: data,
                success: function (result) {
                    if (result.Success) {
                        layer.msg("添加成功！", { icon: 1 }, function () { window.location.reload() });
                    } else {
                        layer.msg("添加失败！", { icon: 2 });
                    }
                }
            })
        })
    })
})

$("#DelFile").click(function () {
    var number = '';
    $('input:checkbox[name=checkName]:checked').each(function (k) {
        if (k == 0) {
            number = $(this).val();
        } else {
            number += ',' + $(this).val();
        }
    })
    layer.confirm('真的要删除吗？', function (index) {
        $.ajax({
            url: "/MyFile/DelFile?Id=" + number,
            type: "post",
            data: data,
            success: function (result) {
                $.ajax({
                    url: "/MyFile/DelFile",
                    type: "post",
                    success: function (result) {
                        if (result.Success) {
                            layer.msg("刪除成功！", { icon: 1, time: 2000 }, function () { window.location.reload() })
                        } else {
                            layer.msg("刪除失敗！", { icon: 2, time: 2000 });
                        }
                    }
                })

            }
        })
    })
})